#include "stdafx.h"
#include "game_engine.h"

namespace rpg {

	bool GameEngine::frameStarted(const Ogre::FrameEvent &evt) {
		return !mQuitFlag;
	}

	bool GameEngine::frameRenderingQueued(const Ogre::FrameEvent &evt) {
		return !mQuitFlag;
	}

	bool GameEngine::frameEnded(const Ogre::FrameEvent &evt) {
		if(mKeyboard != NULL) {
			captureKeyboard();
			processKeyboard(evt.timeSinceLastFrame);
		}

		if(mMouse != NULL) {
			captureMouse();
			processMouse(evt.timeSinceLastFrame);
		}

		if(mKeyboardNextRepeat >= 0.0f)
			mKeyboardNextRepeat -= evt.timeSinceLastFrame;

		mGameLevel.update(evt.timeSinceLastFrame);

		return !mQuitFlag;
	}

}